import re
email = []
with open("mail.txt","r",encoding="utf-8") as f:
    f = f.readlines()
    for i in f:
        match = re.search(r'^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$', i)
        if match:
            email.append(match.group())
            email.append("\n")

with open("mailout.txt","w",encoding="utf-8") as w:
    w.writelines(email)